﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DailyRssDownload.Lib {
	[Serializable]
	public class SummarySource {
		public enum SummarySourcesEnum {
			None,
			BeginningOfDescription,
			EntireDescription
		}

		public SummarySourcesEnum SummarySourceValue { get; set; }
		public string SummarySourceDescription {
			get {
				switch (SummarySourceValue) {
					case SummarySourcesEnum.None:
						return "No Summary";
					case SummarySourcesEnum.BeginningOfDescription:
						return "Extract from the content";
					case SummarySourcesEnum.EntireDescription:
						return "Use the RSS description field";
					default:
						throw new DailyRssDownloadException("Unknown Summary Source: " + SummarySourceValue);
				}
			}
		}

		public SummarySource() {
		}

		public SummarySource(SummarySourcesEnum objSourceEnum) {
			this.SummarySourceValue = objSourceEnum;
		}

		public static IList<SummarySource> GetAllSummarySources() {
			IList<SummarySource> lstAllSources = new List<SummarySource>();

			lstAllSources.Add(new SummarySource(SummarySourcesEnum.None));
			lstAllSources.Add(new SummarySource(SummarySourcesEnum.BeginningOfDescription));
			lstAllSources.Add(new SummarySource(SummarySourcesEnum.EntireDescription));

			return lstAllSources;
		}

		public override string ToString() {
			return SummarySourceDescription;
		}
	}
}
